package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.dto.UserDto;
import com.zzyl.entity.User;
import com.zzyl.vo.UserVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface UserMapper {

    Page<UserVo> page(UserDto userDto);

    void addUser(User user);

    void update(User user);

    @Update("update sys_user set data_state = #{dataState},update_time = #{updateTime} where id =#{id}")
    void updateStatus(User user);

    @Select("select * from sys_user where real_name = #{name}")
    UserVo getByName(String name);

    @Update("update sys_user set is_delete = 1,update_time = #{updateTime} where id = #{id}")
    void delete(User user);

    @Update("update sys_user set password = #{password},update_time = #{updateTime} where id = #{id}")
    void resetPassword(User user);

    @Select("select * from sys_user where username = #{username}")
    User selectByName(String username);

    List<String> selectPathById(Long id);
}
